
<template>
	<div class="box confirm-order-box" >
		<div>
			<confirm-order-header></confirm-order-header>
		</div>
		<div class="content" id="nodeBug">
			<!--<div id="bottomNode">-->
			
			<confirm-order-detail></confirm-order-detail>
			<!--</div>-->
		</div>
		<!--<div class="zxSettle_acount lijixiadan">
			<div class="aui-btn aui-btn-danger aui-btn-block aui-btn-sm" @click.stop="test">去支付</div>
		</div>-->
	</div>
</template>

<script>

import ConfirmOrderDetail from "./ConfirmOrderDetail";
import ConfirmOrderHeader from "./ConfirmOrderHeader";
import {mapGetters,mapMutations} from "vuex";
//import {getPageTree, initDomTree} from "../../utils/getPageTree";

import axios from "axios";
	export default {
	  	name: 'hello',
	  	data () {
	    	return {
				msg: '这是确认订单页面',
	            page: "comfirmOrder",
	            data1:[{text:'上午'},{text:'就是'}],
	            data2:[{text:'中午'},{text:'不是'}],
	            data3:[{text:'下午'},{text:'是'}],
			}
		},
		computed: {
			...mapGetters([
				"getDomTree"
			]),
		},
		components: {
			
	        "confirm-order-detail": ConfirmOrderDetail,
	        "confirm-order-header":ConfirmOrderHeader
	    },
	    methods: {
	       ...mapMutations('zx',[
        		"setTimeNormal","setTimeBig","setFpObj","setTicketList",
        		"setUseGiftCard","setMynode","setDateNormal","setDateBig","setTimeSaveObj"
        	]),
        	//解决支付按钮不固定
        	appendToPay(){
        		setTimeout(()=>{
        			document.querySelector(".confirm-order-box").appendChild(document.querySelector(".zxSettle_acount"))
        		},300)
        	}
	    },
		created () {
			
		},
		mounted () {
			this.appendToPay();
		},
		updated() {
			//页面更新完毕
//			 initDomTree(this.getDomTree[this.page]);
		},
		beforeRouteLeave(to, from, next) {
	    	//只能在父组件中触发    如果去购物车或者支付页面就把vuex中的信息删除
	    	if(to.name == "cart" || to.name == "pay"){
	    		let arr = [];
	    		this.setFpObj({});  // 清空发票
    			this.setTicketList(arr);  //清空优惠券
    			this.setUseGiftCard(false); // 清空钱包选择
    			this.setMynode("");  // 清空留言
    			this.setDateNormal(null); // 清空配送日期
    			this.setDateBig(null);// 清空配送日期
    			this.setTimeNormal({});// 清空配送时间
	    		this.setTimeBig({});// 清空配送时间
	    		this.setTimeSaveObj({});
    		
	    	}
		    console.log(to.name,'去到哪个页面');
		    next();
		},
	}
</script>

<style scoped="scoped">
	.content{
		flex: 1;
		overflow-y: auto;
	}
	.box{
		width: 100%;
	    height: 100%;
		display: flex;
		justify-content: space-between;
		flex-direction: column;
	}
</style>